
{extend name="index/admin-index" /}
{block name="main"}
</style>
  <!-- content start -->
  <div class="admin-content">
    <div class="admin-content-body">
      <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">用户管理</strong> / <small>User management</small></div>
      </div>

      <hr/>

     
      <div class="am-g">
        <div class="am-u-sm-12">
          <table class="am-table am-table-bd am-table-striped admin-content-table">
            <thead>
            <tr>
              <th>ID</th><th>用户名</th><th>电话</th><th>用户邮箱</th><th>用户性别</th><th>用户状态</th><th>注册时间</th><th>管理</th>
            </tr>
            </thead>
            <tbody id='span'>
             {volist name="data" id="v"}
            <tr >
            <td>{$v.id}</td>
            <td>{$v.nickname}</td>
            <td>{$v.tel}</td> 
            <td>{$v.email}</td>
            <td>{$v.sex==1? '男':'女'}</td>
            <td><span  class="{$v.status==1? 'am-badge am-badge-success':'am-badge am-badge-danger'}" abs="{$v.id}" style="cursor: pointer;">{$v.status==1? '正常':'禁用'}</span></td>
            <td>{$v.regtime}</td>
              <td>
                <div class="am-dropdown" data-am-dropdown>
                  <button class="am-btn am-btn-default am-btn-xs am-dropdown-toggle" data-am-dropdown-toggle><span class="am-icon-cog"></span> <span class="am-icon-caret-down"> </span></button>
                  <ul class="am-dropdown-content">
                 
                    <li><a href="/admin/User/show?id={$v.id}">1. 查看</a></li>
                    <li><a data-toggle="modal" data-target="#myModal{$i}">2. 删除</a></li>
                  </ul>
                </div>
              </td>
            </tr>
            <!-- Modal -->
                        <div class="modal fade" id="myModal{$i}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
                          <div class="modal-dialog" role="document" style="margin-top:80px">
                            <div class="modal-content">
                              <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                <h4 class="modal-title" id="myModalLabel">消息提醒</h4>
                              </div>
                              <div class="modal-body">
                               你确定要删除?
                              </div>
                              <div class="modal-footer">
                                <button type="button" class="btn btn-default"><a href="{:url('User/del',['id'=>$v.id])}">确定</a></button>
                                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                              </div>
                            </div>
                          </div>
                        </div>
            {/volist}


           
            </tbody>
          </table>
        </div>
      </div>

  

    </div>

<a href="#" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu" data-am-offcanvas="{target: '#admin-offcanvas'}"></a>
 
<footer>
  <hr>
  <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
</footer>
  </div>


  <script>
    $('#span span').click(function(){
      var id=$(this).attr('abs');
      var sa=$(this);
        $.ajax({
            type: 'get',
            url: "{:url('admin/User/status')}",
            data: 'id='+id,
            dataType:'json',
            success: function(data){
             console.log(data);
            if (data===1) {
              $(sa).html('正常').attr('class','am-badge am-badge-success');
            }else{
               $(sa).html('禁用').attr('class','am-badge am-badge-danger');
            }

              }


            })

    })
  </script>
{/block}